/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.bath.base;

import java.util.Vector;

/**
 *
 * @author pjl
 */
public abstract class BasicPopulationEnvironment extends BasicEnvironment  {

    final public Object muex = new Object(); // synchnized to this when iterating on the population
    public final Vector<Cell> population;

    protected BasicPopulationEnvironment() {
        super(null);
        population = new Vector<Cell>();
    }
    
     public final void zap() {
        synchronized (muex) {
            for (int i = 0; i < population.size(); i++) {
                Cell cell = (Cell) (population.elementAt(i));
                cell.fitness = -1;
            }
        }
    }

    public Vector<Cell> getPopulation() {
        return population;
    }
    
}
